Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upload extension #685

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Add upload extension #685

wants to merge 16 commits into from

Conversation

ClaytonTDM
Copy link
Contributor

Pretty simple extension that can't be replicated with pre-existing extensions

@BlueDome77
Copy link
Contributor

What would this be useful for?

@ClaytonTDM
Copy link
Contributor Author

I used it in my cloud chat project to have an upload file button that posts a link to the file in chat

@GarboMuffin
Copy link
Member

Is this extension already possible through a combination of files and the HTTP/fetch/Network extensions?

@ClaytonTDM
Copy link
Contributor Author

ClaytonTDM commented Jul 10, 2023

Nope, because of how multipart/form-data uploads are created (see below), it isn't yet possible.

POST /upload HTTP/1.1
Content-Length: 428
Content-Type: multipart/form-data; boundary=abcde12345
--abcde12345
Content-Disposition: form-data; name="id"
Content-Type: text/plain
123e4567-e89b-12d3-a456-426655440000
--abcde12345
Content-Disposition: form-data; name="address"
Content-Type: application/json
{
  "street": "3, Garden St",
  "city": "Hillsbery, UT"
}
--abcde12345
Content-Disposition: form-data; name="profileImage "; filename="image1.png"
Content-Type: application/octet-stream
{…file content…}
--abcde12345--

@GarboMuffin
Copy link
Member

Would it be possible to turn this into a more general file uploading extension?

At least a block like "set file host to [ ]", even if it only has one option for now

@ClaytonTDM
Copy link
Contributor Author

Would it be possible to turn this into a more general file uploading extension?

At least a block like "set file host to [ ]", even if it only has one option for now

It depends on the case. For a service like Gofile, they have multiple servers (store1, store2, etc) so there would have to be custom logic to grab the correct server from their API.
Although, it could work better with both the current upload file to URL, and "upload file to [dropdown]" so there aren't any unnecessary blocks. That's one thing I hate about extensions such as numerical encoding, why have a block that just sets a custom variable when you could have a single reporter?

Anyways, I'll get started on the new block now.

@SaFireGalaxy
Copy link

Hey. something that's annoying with gofile and file.io is they dont provide direct links to the raw image. This really adds tons of limitations so I can't have the image show in my turbowarp project. Is there another hosting exactly like gofile that actually gives you the link to the raw hosted image, so i can have a plugin display the image in the project?

@ClaytonTDM
Copy link
Contributor Author

As far as I know, no. If I find one, I'll be sure to add support for it though.

@SaFireGalaxy
Copy link

Thanks @ClaytonTDM!

@xytrux
Copy link

xytrux commented Aug 27, 2023

Is this getting merged or what?

@LilyMakesThings
Copy link
Contributor

LilyMakesThings commented Aug 27, 2023

Is this getting merged or what?

Please have patience, we're all volunteers here. As stated in CONTRIBUTING.md, "We'll get to you as soon as we can, so please be patient".

Edit: nevermind, patience is not required here lmao

@GarboMuffin
Copy link
Member

hi, sorry for the delay, currently whittling away at a review queue that pilled up during months of long days at work

here's the deal for this extension -

  • The HTTP extension does support multipart now, so this is not as necessary (but still happy to merge it, if you resolve the issues below)
  • It would be great if the extension was not limited to just files on your computer already, but if it also allowed any text, such as data: URI snapshots of the stage from looks+
  • Your scripts need to handle what happens when someone cancels the file dialog. At a bare minimum you can listen for the cancel event, which is a new thing for dealing with this, but support is still very new. This is why the file extension insists on showing a modal.
  • Errors in getGofileServer (for example, if someone denies the fetch) need to be handled

@ClaytonTDM
Copy link
Contributor Author

Sure! I've added all the changes and fixes you mentioned.

@ClaytonTDM
Copy link
Contributor Author

its been like a year

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants